// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.SQLExpr_ptr;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr_ptr;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLImportTableStatement.h"
#include "../../visitor/SQLASTVisitor.h"
#include "../../../utils/listTran.h"
#include "SQLExprTableSource.h"
#include "SQLAssignItem.h"

SQLImportTableStatement::SQLImportTableStatement()
{
  dbType = DbType_ptr(new DbType(&DbType::hive));
  partition = std::make_shared<std::list<SQLAssignItem_ptr>>();
}

SQLExprTableSource_ptr SQLImportTableStatement::getTable()
{
  return table;
}

void SQLImportTableStatement::setTable(SQLExprTableSource_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLImportTableStatement));
  }
  this->table = x;
}

SQLAssignItem_list_ptr SQLImportTableStatement::getPartition()
{
  return partition;
}

SQLExpr_ptr SQLImportTableStatement::getFrom()
{
  return from;
}

void SQLImportTableStatement::setFrom(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLImportTableStatement));
  }
  this->from = x;
}

SQLExpr_ptr SQLImportTableStatement::getLocation()
{
  return location;
}

void SQLImportTableStatement::setLocation(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLImportTableStatement));
  }
  this->location = x;
}

void SQLImportTableStatement::accept0(SQLASTVisitor_ptr v)
{
  if (v->visit(SharedObject(SQLImportTableStatement)))
  {
    acceptChild(v, table);
    SQLObject_list_ptr tmp = ListTran::tran_class<SQLAssignItem, SQLObject>(partition);
    acceptChild(v, tmp);
    acceptChild(v, from);
    acceptChild(v, location);
    acceptChild(v, version);
  }
  v->endVisit(SharedObject(SQLImportTableStatement));
}

SQLIntegerExpr_ptr SQLImportTableStatement::getVersion()
{
  return version;
}

void SQLImportTableStatement::setVersion(SQLIntegerExpr_ptr version)
{
  this->version = version;
}

BOOL_ptr SQLImportTableStatement::isUsingBuild()
{
  return usingBuild;
}

void SQLImportTableStatement::setUsingBuild(BOOL_ptr usingBuild)
{
  this->usingBuild = usingBuild;
}

BOOL_ptr SQLImportTableStatement::isExtenal()
{
  return extenal;
}

void SQLImportTableStatement::setExtenal(BOOL_ptr extenal)
{
  this->extenal = extenal;
}
